home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / pthd-0.000 / pthd-0 / pthd-0.7 / include / utils.h < prev   
Encoding:
C/C++ Source or Header  |  1995-08-16  |  1.9 KB  |  109 lines

  1. /*
  2.  * --  utils.h
  3.  */
  4. #ifndef _utils_
  5. #define _utils_
  6. #include <pthread.h>
  7. #include <sys/stat.h>
  8. #include <unistd.h>
  9. #include <string.h>
  10. #include <errno.h>
  11. #include <dirent.h>
  12. #include <stdio.h>
  13. #if __STDC__
  14. # include <stdarg.h>
  15. #else
  16. # include <varargs.h>       /* It's a BSD system */
  17. #endif
  18.  
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22.  
  23. extern int
  24. fprintf_r( FILE *stream, const char *format, ... );
  25.  
  26. extern int
  27. printf_r( const char *format, ... );
  28.  
  29. extern void *
  30. malloc_r( size_t bytes );
  31.  
  32. extern void
  33. free_r( void *ptr );
  34.  
  35. extern struct dirent *
  36. readdir_r( DIR *dir );
  37.  
  38. extern DIR *
  39. opendir_r( const char *name );
  40.  
  41. extern int
  42. closedir_r( DIR *dp );
  43.  
  44. extern void
  45. print_system_counters( void );
  46.  
  47. extern int
  48. create_joinable( pthread_t *th, thread_proc_t proc, void *arg );
  49.  
  50. extern char *
  51. strchr_r( const char *s, int c );
  52.  
  53. extern char *
  54. strrchr_r( const char *s, int c );
  55.  
  56. extern char *
  57. strcpy_r( char *dest, const char *src );
  58.  
  59. extern char *
  60. strncpy_r( char *dest, const char *src, size_t n );
  61.  
  62. extern size_t
  63. strlen_r( const char *s );
  64.  
  65. extern int
  66. strcmp_r( const char *s1, const char *s2 );
  67.  
  68. extern int
  69. strncmp_r( const char *s1, const char *s2, size_t p );
  70.  
  71. extern long
  72. strtol_r( const char *nptr, char **endptr, int base );
  73.  
  74. extern char *
  75. strerror_r( int errno );
  76.  
  77. extern char *
  78. strcat_r( char *dest, const char *src );
  79.  
  80. extern char *
  81. strncat_r( char *dest, const char *src, size_t n );
  82.  
  83. extern int
  84. stat_r( const char *file_name, struct stat *buf );
  85.  
  86. extern int
  87. fstat_r( int filedes, struct stat *buf );
  88.  
  89. extern int
  90. lstat_r( const char *file_name, struct stat *buf );
  91.  
  92. #define THREAD_SUCCESS ((void *)SUCCESS)
  93. #define THREAD_FAILURE ((void *)FAILURE)
  94.  
  95. #define CHECK(status,msg) \
  96.         { \
  97.            if( status == FAILURE ) \
  98.            { \
  99.                fprintf_r(stderr, "%s!\n", msg ); \
  100.                pthread_exit( THREAD_FAILURE ); \
  101.            } \
  102.        }
  103.  
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif
  108.  
  109.